<?php
$hostname_CrossFit = "localhost";
$database_CrossFit = "quadnips_CF26AppsDev";
$username_CrossFit = "quadnips_26";
$password_CrossFit = "fearless";
$CrossFit = mysql_pconnect($hostname_CrossFit, $username_CrossFit, $password_CrossFit) or trigger_error(mysql_error(),E_USER_ERROR); 

?>
<?php

  mysql_select_db($database_CrossFit, $CrossFit);
  	
  $LoginRS__query="SELECT Username, Password, Level FROM Login WHERE Username=$_POST['Username'] AND Password=SHA1($_POST['Password'])"; 
   
  $LoginRS = mysql_query($LoginRS__query, $CrossFit) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);

  if ($loginFoundUser) {
    session_start();
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $row['Username'];
    $_SESSION['MM_UserGroup'] = $row['Level'];	      
    header("Location: http://development.crossfit26.com/app/attendance/" );
  }
  else {
    header("Location: http://development.crossfit26.com/app/?loginerror=Your username and password were not correct.");
}

?>



